﻿using System;

using Fuse8.DomainFramework.Domain;
using Fuse8.DomainFramework.DataAccess;

namespace Fuse8.DomainFramework.Configuration.Fluent
{
    /// <summary>
    /// 
    /// </summary>
    public static class FrameworkDataRepositoryTypeExtensions
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dataRepositoryType"></param>
        /// <returns></returns>
        public static IFrameworkDataRepositoryType InMemory(this IFrameworkDataRepositoryType dataRepositoryType)
        {
            return new InMemoryDataRepositoryType();
        }
    }

    /// <summary>
    /// 
    /// </summary>
    public interface IFrameworkDataRepositoryType
    {
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <returns></returns>
        IUnitOfWorkFactory<TEntity> CreateUnitOfWorkFactory<TEntity>()
            where TEntity : class, IEntityObject, new();

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <typeparam name="TRepository"></typeparam>
        /// <returns></returns>
        IEntityDataRepositoryMapper<TEntity, TRepository> CreateDataMapper<TEntity, TRepository>()
            where TEntity : class, IEntityObject
            where TRepository : class;

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <typeparam name="TKey"></typeparam>
        /// <returns></returns>
        IEntityDataRepository<TEntity, TKey> CreateDataRepository<TEntity, TKey>()
            where TEntity : class, IEntityObject<TKey>, new()
            where TKey : IComparable<TKey>, IEquatable<TKey>;
    }
}
